package com.zto.mybatis.custom2.config;

import com.zto.mybatis.custom2.config.pojo.User2;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by xingyuchao on 2017-07-09.
 */
public class MapperRegistory {

    public static final Map<String,MapperData> methodSqlMapping = new HashMap<String,MapperData>();

    public MapperRegistory() {
        methodSqlMapping.put("com.zto.mybatis.custom2.config.mappers.User2Mapper.selectByPrimaryKey",new MapperData("select * from user2 where id = %d",User2.class));
    }


    public class MapperData<T> {

        private String sql;

        private Class<T> type;

        public MapperData(String sql, Class<T> type) {
            this.sql = sql;
            this.type = type;
        }

        public String getSql() {
            return sql;
        }

        public Class<T> getType() {
            return type;
        }

        public void setSql(String sql) {
            this.sql = sql;
        }

        public void setType(Class<T> type) {
            this.type = type;
        }
    }

    public MapperData get(String nameSpace) {
        return methodSqlMapping.get(nameSpace);
    }
}
